<script setup lang="ts">
import type { UserVO } from '@/api/User.ts'

const props = defineProps<{
  user: UserVO
}>()

defineEmits<{
  (e: 'close'): void
}>()
</script>

<template>
<a-descriptions bordered size="small" :column="1">
  <a-descriptions-item label="ID">{{ props.user.id }}</a-descriptions-item>
  <a-descriptions-item label="账号">{{ props.user.account }}</a-descriptions-item>
  <a-descriptions-item label="昵称">{{ props.user.name }}</a-descriptions-item>
  <a-descriptions-item label="性别">{{ props.user.gender === 0 ? '男' : props.user.gender === 1 ? '女' : '' }}</a-descriptions-item>
  <a-descriptions-item label="邮箱">{{ props.user.email || '暂无' }}</a-descriptions-item>
  <a-descriptions-item label="简介">{{ props.user.profile || '暂无' }}</a-descriptions-item>
  <a-descriptions-item label="角色">{{ props.user.role }}</a-descriptions-item>
  <a-descriptions-item label="提交数">{{ props.user.submit ?? 0 }}</a-descriptions-item>
  <a-descriptions-item label="通过数">{{ props.user.solved ?? 0 }}</a-descriptions-item>
  <a-descriptions-item label="通过率">
    <span>
      {{ props.user.submit && props.user.submit > 0 ? ((Number(props.user.solved) / Number(props.user.submit)) * 100).toFixed(2) + '%' : '0.00%' }}
    </span>
  </a-descriptions-item>
</a-descriptions>
</template>

<style scoped>

</style>
